package com.crayon.cardbiz.adaper;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.crayon.cardbiz.R;
import com.crayon.cardbiz.dic.EntryDic;

public class AdapterBaseEntry extends ArrayAdapter<EntryDic> {

	private final LayoutInflater mInflater;

	public AdapterBaseEntry(Context context) {
		super(context, android.R.layout.simple_list_item_1);
		// TODO Auto-generated constructor stub
		mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}


	public AdapterBaseEntry(Context context, int textViewResourceId,
			EntryDic[] objects) {
		super(context, textViewResourceId, objects);
		mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

	}


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View view  = convertView!=null ?convertView:mInflater.inflate(android.R.layout.simple_list_item_1, parent, false);

		//        AppEntry item = getItem(position);
		EntryDic item  = getItem(position);
		//        ((ImageView)view.findViewById(R.id.icon)).setImageDrawable(item.name());
		((TextView)view.findViewById(android.R.id.text1)).setText(item.name);

		return view;

	}



}
